package com.volcengine.example.iam.saml;

import com.alibaba.fastjson.JSON;
import com.volcengine.model.request.iam.UpdateSAMLProviderRequest;
import com.volcengine.model.response.iam.UpdateSAMLProviderResponse;
import com.volcengine.service.iam.IIamService;
import com.volcengine.service.iam.impl.IamServiceImpl;

public class UpdateSAMLProviderDemo {

    public static void main(String[] args) {
        IIamService iamService = IamServiceImpl.getInstance();
        // call below method if you dont set ak and sk in ～/.volc/config

        iamService.setAccessKey("Your AK");
        iamService.setSecretKey("Your SK");
        // list users
        try {
            UpdateSAMLProviderRequest request = new UpdateSAMLProviderRequest();
            request.setSAMLProviderName("provider_name");
            request.setNewEncodedSAMLMetadataDocument("PEVudGl0eURlc2NyaXB0b3IgeG1sbnM9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDptZXRhZGF0YSIgdmFsaWRVbnRpbD0iMjAyMi0xMi0xMlQxNzoxOTo0Mi4yNDZaIiBlbnRpdHlJRD0idGVzdElEUCI+CiAgPElEUFNTT0Rlc2NyaXB0b3IgeG1sbnM9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDptZXRhZGF0YSIgcHJvdG9jb2xTdXBwb3J0RW51bWVyYXRpb249InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpwcm90b2NvbCI+CiAgICA8S2V5RGVzY3JpcHRvciB1c2U9InNpZ25pbmciPgogICAgICA8S2V5SW5mbyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyI+CiAgICAgICAgPFg1MDlEYXRhIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIj4KICAgICAgICAgIDxYNTA5Q2VydGlmaWNhdGUgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyMiPk1JSURJekNDQWd1Z0F3SUJBZ0lVWHluQ3NPL09SVTVuNUdVQU9QY2pkRnVobDdBd0RRWUpLb1pJaHZjTkFRRUxCUUF3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hVL1VvNTlDcU4zTTwvWDUwOUNlcnRpZmljYXRlPgogICAgICAgIDwvWDUwOURhdGE+CiAgICAgIDwvS2V5SW5mbz4KICAgIDwvS2V5RGVzY3JpcHRvcj4KICAgIDxOYW1lSURGb3JtYXQ+dXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOm5hbWVpZC1mb3JtYXQ6dHJhbnNpZW50PC9OYW1lSURGb3JtYXQ+CiAgICA8U2luZ2xlU2lnbk9uU2VydmljZSBCaW5kaW5nPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YmluZGluZ3M6SFRUUC1QT1NUIiBMb2NhdGlvbj0iaHR0cDovL2xvY2FsaG9zdDo2Nzg5L3NzbyI+PC9TaW5nbGVTaWduT25TZXJ2aWNlPgogICAgPFNpbmdsZVNpZ25PblNlcnZpY2UgQmluZGluZz0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmJpbmRpbmdzOkhUVFAtUmVkaXJlY3QiIExvY2F0aW9uPSJodHRwOi8vbG9jYWxob3N0OjY3ODkvc3NvIj48L1NpbmdsZVNpZ25PblNlcnZpY2U+CiAgPC9JRFBTU09EZXNjcmlwdG9yPgo8L0VudGl0eURlc2NyaXB0b3I+");
            request.setDescription("description");
            request.setSSOType(2);
            request.setStatus(1);

            UpdateSAMLProviderResponse response = iamService.updateSAMLProvider(request);
            System.out.println(JSON.toJSONString(response));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
